Skip to content

Fix flaky TestKeepAlive_ConcurrentFramesNoInterleaving - #220

Merged
rdimitrov merged 1 commit into
mainfrom
worktree-219-flaky
Aug 13, 2026
Merged

Fix flaky TestKeepAlive_ConcurrentFramesNoInterleaving#220
rdimitrov merged 1 commit into
mainfrom
worktree-219-flaky

Conversation

@jhrozek

@jhrozek jhrozek commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • TestKeepAlive_ConcurrentFramesNoInterleaving asserted comments > 0, racing 1600 in-memory writes against a 1ms ticker — on fast machines the writes finish and stopKeepAlive() runs before the ticker ever fires, so comments is 0.
  • Dropped that assertion from the interleaving test (its real guarantee — no split/interleaved frames — is unaffected) and added TestKeepAlive_TickerEmitsComment, which waits deterministically via require.Eventually instead of assuming a tick happens within a fixed window of work.

Fixes #219

Test plan

  • go test -race -count=10 -run TestKeepAlive ./mcpcompat/server/ — all pass
  • task lint

The comments>0 assertion raced 1600 in-memory writes against a 1ms
ticker and lost deterministically on fast machines. Split it into a
separate test that waits for a tick via require.Eventually instead of
tightening the timing.

Fixes #219
@rdimitrov
rdimitrov merged commit 2abad5f into main Aug 13, 2026
5 checks passed
@rdimitrov
rdimitrov deleted the worktree-219-flaky branch August 13, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestKeepAlive_ConcurrentFramesNoInterleaving fails deterministically on fast machines (timing-dependent assertion)

2 participants